#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int t; cin >> t;
	while (t--)
	{
		int n; cin >> n;
		long long A = 0, B = 0;
		map<int, int> cnt;
		while (n--)
		{
			int a; cin >> a;
			if (a % 2 == 0) A = B = A + a / 2;
			else cnt[a]++, A = B = A + a / 2;
		}
		vector<int> odd;
		for (auto& e : cnt) odd.push_back(e.second);
		sort(odd.begin(), odd.end(), greater<int>());
		for (int i = 0; i < odd.size(); i += 2) A += odd[i];
		for (int i = 1; i < odd.size(); i += 2) B += odd[i];
		cout << A << ' ' << B << endl;
	}

	return 0;
}